package edu.gatech.cs2340.teamrocket.model.pokemon.ailments;

import edu.gatech.cs2340.teamrocket.model.pokemon.Pokemon;

/**
 * Represents a Poison status ailment.
 *
 * @author Joe Tacheron
 */
public class Poison implements Ailment {

    protected static final int DAMAGE = Pokemon.MAX_HEALTH / 16;

    private static final String[] POISON_TYPE_POKEMON = {
        "Ekans",
        "Arbok",
        "Weedle",
        "Spinarak"
    };

    /**
     * Lose 1/16 of max health.
     *
     * @param t
     * @return
     */
    @Override
    public String affect(Pokemon t) {
        t.takeDamage(DAMAGE);
        if(t.isFainted())
            return faintMessage(t);
        else
            return null;
    }

    @Override
    public String catchMessage(Pokemon t) {
        String pokemon = POISON_TYPE_POKEMON[(int)(Math.random() * POISON_TYPE_POKEMON.length)];
        return t + " was poisoned by a wild " + pokemon + "!";
    }

    @Override
    public String healMessage(Pokemon t) {
        return t + " has healed from poison!";
    }

    @Override
    public String faintMessage(Pokemon t) {
        return t + " has fainted from poison!";
    }

    /**
     *
     * @return true
     */
    @Override
    public boolean healedByFullHeal() {
        return true;
    }

    @Override
    public String hurtMessage(Pokemon t) {
        return t + " is hurt by poison!";
    }

    /**
     *
     * @return "PSN" colored purple
     */
    @Override
    public String statusString() {
        return "<span color='purple'>PSN</span>";
    }
}